package com.settlement.system.model.entity.common;

import com.alibaba.excel.annotation.ExcelIgnoreUnannotated;
import com.alibaba.excel.annotation.ExcelProperty;
import com.alibaba.excel.annotation.write.style.HeadFontStyle;
import com.alibaba.excel.annotation.write.style.HeadRowHeight;
import com.alibaba.excel.annotation.write.style.HeadStyle;
import com.settlement.system.common.util.common.QueryJoinTableUtil;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;

import java.io.Serializable;
/**
 * 联表查询主表
 * @author xiaochuan
 * @since 2022-01-13
 */
@Data
@ExcelIgnoreUnannotated
@HeadStyle(fillBackgroundColor = 9,fillForegroundColor = 9)
@HeadRowHeight(value = 20)
@HeadFontStyle(fontHeightInPoints = 14)
public class TblQueryJoinTable extends BaseModel implements Serializable {


    /**
     * 查询名称
     */
    @ExcelProperty(value = "查询名称")
    @ApiModelProperty(value = "查询名称")
    private String queryName;

    /**
     * 表名
     */
    @ExcelProperty(value = "表名")
    @ApiModelProperty(value = "表名")
    private String tableName;

    /**
     * 条件
     */
    @ExcelProperty(value = "条件")
    @ApiModelProperty(value = "条件")
    private String condition;

    /**
     * 分组条件
     */
    @ExcelProperty(value = "分组条件")
    @ApiModelProperty(value = "分组条件")
    private String groupCondition;

    /**
     * 查询字段
     */
    @ExcelProperty(value = "查询字段")
    @ApiModelProperty(value = "查询字段")
    private String selectedFields;

    /**
     * 分组字段
     */
    @ExcelProperty(value = "分组字段")
    @ApiModelProperty(value = "分组字段")
    private String groupFields;

    /**
     * 汇总字段
     */
    @ExcelProperty(value = "汇总字段")
    @ApiModelProperty(value = "汇总字段")
    private String summaryFields;

    @ExcelProperty(value = "sqlStr")
    @ApiModelProperty(value = "sqlStr")
    private String sqlStr;

    /**
     * 汇总查询SQL
     */
    @ExcelProperty(value = "groupSqlStr")
    @ApiModelProperty(value = "groupSqlStr")
    private String groupSqlStr;

    /**
     * 条件json
     */
    @ExcelProperty(value = "条件json")
    @ApiModelProperty(value = "条件json")
    private String conditionJson;

    /**
     * 关联表json
     */
    @ExcelProperty(value = "关联表json")
    @ApiModelProperty(value = "关联表json")
    private String tableJson;

    /**
     * 查询行数
     */
    @ExcelProperty(value = "查询行数")
    @ApiModelProperty(value = "查询行数")
    private Integer selectCount;

    /**
     * 总行数
     */
    @ExcelProperty(value = "总行数")
    @ApiModelProperty(value = "总行数")
    private Integer totalCount;

    Integer returnCount;

    String returnStr;

    boolean success;

    String errorMsg;

    boolean ifCount;

    /**
     * 查询类型：1明细、 2汇总
     */
    String queryTypeNo;

    public String getCondition() {
        return condition;
    }

    public void setCondition(String condition) {
        this.condition = QueryJoinTableUtil.encode(condition);
    }

    public String getSqlStr() {
        return sqlStr;
    }

    public void setSqlStr(String sqlStr) {
        this.sqlStr = QueryJoinTableUtil.encode(sqlStr);
    }

    public String getReturnStr() {
        return returnStr;
    }

    public void setReturnStr(String returnStr) {
        this.returnStr = QueryJoinTableUtil.encode(returnStr);
    }

    public String getGroupCondition() {
        return groupCondition;
    }

    public void setGroupCondition(String groupCondition) {
        this.groupCondition = QueryJoinTableUtil.encode(groupCondition);
    }

    public String getGroupSqlStr() {
        return groupSqlStr;
    }

    public void setGroupSqlStr(String groupSqlStr) {
        this.groupSqlStr = QueryJoinTableUtil.encode(groupSqlStr);
    }

}
